#include<cstdio>
#include<cstring>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=5010;
int n,head[MAXN],cnt,mx;
LL ans,t1[MAXN],t2[MAXN],t3[MAXN];
struct edge
{
	int v,next;
}e[MAXN*2];
void addedge(int x,int y)
{
	e[++cnt]=(edge){y,head[x]};
	head[x]=cnt;
	return;
}
void dfs(int u,int dep,int fa)
{
	++t3[dep];
	mx=max(mx,dep);
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].v;
		if(v==fa)continue;
		dfs(v,dep+1,u);
	}
	return;
}
int main()
{
	n=read();
	for(int i=1;i<n;++i)
	{
		int x=read(),y=read();
		addedge(x,y);addedge(y,x);
	}
	for(int i=1;i<=n;++i)
	{
		memset(t1,0,sizeof(t2));
		memset(t2,0,sizeof(t3));
		for(int j=head[i];j;j=e[j].next)
		{
			dfs(e[j].v,1,i);
			for(int k=1;k<=mx;++k)
			{
				ans+=t1[k]*t3[k];
				t1[k]+=t2[k]*t3[k];
				t2[k]+=t3[k];
			}
			do{t3[mx--]=0;}while(mx);
		}
	}
	printf("%lld\n",ans);
	return 0;
}
